package com.etc.admin.util;

import java.util.List;

/**
 * 分页数据类
 */
public class PageData<T> {
	private List<T> data; // 查找[页面上显示]的数据

	private Integer count ; // 总记录数

	private Integer pageSize;// 每页几行

	private Integer page;// 页数
	

	
	public PageData() {
		super();
	}



	public PageData(List<T> data, Integer count, Integer pageSize, Integer page) {
		super();
		this.data = data;
		this.count = count;
		this.pageSize = pageSize;
		this.page = page;
	}



	public PageData(List<T> data, Integer count, Integer pageSize, Integer page, int code, String msg) {
		super();
		this.data = data;
		this.count = count;
		this.pageSize = pageSize;
		this.page = page;
		this.code = code;
		this.msg = msg;
	}



	public List<T> getData() {
		return data;
	}



	public void setData(List<T> data) {
		this.data = data;
	}



	public Integer getCount() {
		return count;
	}



	public void setCount(Integer count) {
		this.count = count;
	}



	public Integer getPageSize() {
		return pageSize;
	}



	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}



	public Integer getPage() {
		return page;
	}



	public void setPage(Integer page) {
		this.page = page;
	}



	public int getCode() {
		return code;
	}



	public void setCode(int code) {
		this.code = code;
	}



	public String getMsg() {
		return msg;
	}



	public void setMsg(String msg) {
		this.msg = msg;
	}



	private int code;//
	
	private String msg;//显示的信息

	

	/**
	 * 总页数
	 * 
	 * @return
	 */
	public int getCountPage() {
		// count是总记录数 100/10 101/10
		int num = count / pageSize;
		if (count % pageSize != 0) {
			num++;
		}
		return num;
	}



	@Override
	public String toString() {
		return "PageData [data=" + data + ", count=" + count + ", pageSize=" + pageSize + ", page=" + page + ", code="
				+ code + ", msg=" + msg + "]";
	}


}
